﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Hisun.Models;

namespace Hisun.View.SCRB
{
    public class SCRB
    {
    }

    public class Batch
    {

        HisunDBDataContext db = new HisunDBDataContext();

        public bool DelBatch(string BatchNo)
        {
            var q = from a in db.TSCRB_JS_BatchInfo
                    where a.批号 == BatchNo
                    select a;
            db.TSCRB_JS_BatchInfo.DeleteAllOnSubmit(q);

            var q2 = from a in db.TSCRB_JS_BatchInfoDetail
                     where a.批号 == BatchNo
                     select a
                    ;
            db.TSCRB_JS_BatchInfoDetail.DeleteAllOnSubmit(q2);

            try
            {
                db.SubmitChanges();
            }
            catch
            {
                return false;
            }
            return true;



        }
    }
}
